1. Field of the Invention
The present general inventive concept relates to a media transfer protocol (MTP), and more particularly, to a method and apparatus to control an MTP device to store a file received from an MTP host.
2. Description of the Related Art
A media transfer protocol (MTP) is a protocol developed by Microsoft to be used in a portable device, such as a digital camera or an MP3 player, including a hard disk drive.
In order to connect a conventional mass storage class (MSC) based portable device and a window media device manager (WMDM) application program interface (API), a user has to install a device driver. Also, a personal computer (PC) recognizes the portable device as a passive movable storage device, and so a user has to execute an explorer of Microsoft Windows so as to manage files stored in a hard disk of the portable device.
However, in an MTP device, a device driver is already included in a Windows Media Player. Accordingly, a file transmission or a synchronization between a portable device (MTP device) and a PC (MTP host) is possible in the Windows Media Player, and digital right management (DRM) can be effectively applied on media files.
FIG. 1 is a flowchart illustrating conventional processes of transmitting a file between an MTP device and an MTP host.
In operation 101, the MTP host requests the MTP device for information about object handles.
In operation 102, the MTP host receives the information about object handles from the MTP device.
A file allocation table (FAT) file system used by a MSC based portable device is recognized as another “drive” of a PC when connected to the PC. Accordingly, the file system of the portable device is directly managed by the PC, whereas a file system of the MTP device is not recognized by the MTP host.
However, even if the MTP host does not recognize the file system of the MTP device, objects, such as files and folders, stored in the file system of the MTP device can be specified by using an object handle obtained via communication between the MTP host and the MTP device. Accordingly, there is no problem in transmitting files between the MTP device and the MTP host. Here, the object handle denotes an identifier used to specify an object in the file system of the MTP device between the MTP device and the MTP host.
In operation 103, the MTP host analyzes metadata of a media file that is to be transmitted to the MTP device. For example, when the media file is an MP3 audio file, metadata may include an artist, an album, a genre of music, etc.
In operation 104, the MTP host transmits the media file and an object handle, which indicates a location where the media file is to be stored, to the MTP device. Generally, the object handle indicates a parent object of the media file.
In operation 105, the MTP device stores the media file in the location indicated by the object handle, and updates a database of media files.
In operation 106, the MTP device transmits information about updated object handles to the MTP host.
Accordingly, the MTP device and the MTP host build a directory hierarchy in the MTP device according to the metadata of the media file, and thus the user does not need to individually determine a folder to be stored while directly generating a folder in the file system of the MTP device or storing a media file in the MTP device.
FIG. 2 is a diagram illustrating a conventional directory hierarchy built in a file system of an MTP device having an MTP module and a file system.
As illustrated in FIG. 2, an MTP host commands the MTP device to generate folders, such as an <AUDIO> folder, an <ARTIST> folder, a <BEATLES> folder, a <video> folder, etc., according to metadata of a media file, and to store the media file in the <BEATLES> folder. Although not illustrated in FIG. 2, a media file of metadata without any of the above-described folders can be stored in an <UNKNOWN> folder.
As described above, according to the conventional technology, a music file of a certain artist is stored in the same folder of the MTP device, and specifically in the <UNKNOWN> folder.
Accordingly, when the MTP device is used for a long time, the number of media files stored in one folder increases, and thus the speed of reading and writing the media file decreases. Consequently, the speed of transmitting a file from the MPT host to the MTP device decreases, causing a user inconvenience. Such problem becomes more serious when the amount of content provided by a content provider increases and the storage capacity of a portable device increases.